<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.common-layout {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.el-header {
  background-color: darkslategray;
  flex: 0 0 auto;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.el-aside {
  background-color: #304156;
  /* 统一的侧边栏背景颜色 */
  height: 100%;
  padding: 0;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.el-menu {
  background-color: #304156;
  /* 统一的菜单背景颜色 */
  border-right: none;
}

.el-sub-menu__title,
.el-menu-item {
  color: #bfcbd9 !important;
}

.el-sub-menu__title:hover,
.el-menu-item:hover {
  color: #fff !important;
  background-color: #263445 !important;
}

.el-menu-item.is-active {
  color: #409EFF !important;
  background-color: #263445 !important;
}

.el-main {
  padding: 20px;
  background-color: #f5f7fa;
}

.app-title {
  font-weight: bold;
  font-size: 1.5rem;
}

.exit-button {
  color: white;
  padding: 0;
  display: flex;
  align-items: center;
}

.content-card {
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  background-color: white;
  height: 100%;
}

.content-header {
  padding: 15px 20px;
  border-bottom: 1px solid #ebeef5;
  font-size: 1.2rem;
  font-weight: bold;
  color: darkslategray;
}

.content-body {
  padding: 20px;
}

.page-title {
  color: darkslategray;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ebeef5;
}

.demo-content {
  padding: 20px;
  color: #606266;
  line-height: 1.8;
}

.demo-content h2 {
  color: #304156;
  margin-bottom: 15px;
}

.demo-content p {
  margin-bottom: 15px;
}
</style>
<template>
  <div id="app">
    <div class="common-layout">
      <el-container style="height: 100vh; display: flex; flex-direction: column;">
        <el-header>
          <div style="font-weight: bold; font-size: larger;">万事屋后台管理系统</div>
          <div style="display: flex; align-items: center;">
            <el-icon>
              <CaretRight />
            </el-icon>
            <el-button type="text" style="color: white; padding: 0;" @click="quit">退出</el-button>
          </div>
        </el-header>

        <el-container style="flex: 1;">
          <el-aside width="200px">
            <el-menu default-active="1" class="el-menu-vertical-demo" router>
              <el-menu-item index="dashboard">
                <template #title>
                  <el-icon>
                    <DataAnalysis />
                  </el-icon>
                  <span>数据统计</span>
                </template>
              </el-menu-item>
              <el-sub-menu index="2">
                <template #title>
                  <el-icon>
                    <User />
                  </el-icon>
                  <span>用户管理</span>
                </template>
                <el-menu-item index="userList">用户信息</el-menu-item>
              </el-sub-menu>

              <el-sub-menu index="3">
                <template #title>
                  <el-icon>
                    <Setting />
                  </el-icon>
                  <span>商户管理</span>
                </template>
                <el-menu-item index="merchantList">商户管理</el-menu-item>
                <el-menu-item index="goodsList">商品管理</el-menu-item>
                <el-menu-item index="groupBuyList">团购管理</el-menu-item>
                <el-menu-item index="orderList">订单管理</el-menu-item>
              </el-sub-menu>

              <el-sub-menu index="4">
                <template #title>
                  <el-icon>
                    <Money />
                  </el-icon>
                  <span>帖子管理</span>
                </template>
              </el-sub-menu>

              <el-menu-item index="system">
                <template #title>
                  <el-icon>
                    <DataAnalysis />
                  </el-icon>
                  <span>系统设置</span>
                </template>
              </el-menu-item>
            </el-menu>
          </el-aside>

          <el-main>
            <div class="content-card">
              <router-view></router-view>
            </div>
          </el-main>
        </el-container>
      </el-container>
    </div>
  </div>
</template>
<script setup>

import server from "../utils/request.js";
import router from "../router/index.js";

function quit(){
  //清除token
  sessionStorage.clear()
  //跳到登路页
  router.push("blogin")
}
</script>